// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_img.p_video;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;

public class cls_EvenlySpacedLayout extends ViewGroup
{

    public cls_EvenlySpacedLayout(Context context, AttributeSet attributeset)
    {
        super(context, attributeset);
        a = true;
    }

    private void a(boolean flag, int i, int j, int k, int l)
    {
        int i1 = getChildCount();
        int j1 = 0;
        int k1 = 0;
        int l1 = 0;
        while(j1 < i1) 
        {
            View view1 = getChildAt(j1);
            if(view1.getVisibility() != 8)
            {
                l1 += view1.getMeasuredWidth();
                k1++;
            }
            j1++;
        }
        int i2 = k - i - l1;
        int j2;
        int k2;
        int l2;
        int i3;
        if(b)
            j2 = k1 + 1;
        else
            j2 = k1 + -1;
        k2 = i2 / j2;
        if(b)
            l2 = k2;
        else
            l2 = 0;
        i3 = 0;
        while(i3 < i1) 
        {
            View view = getChildAt(i3);
            if(view.getVisibility() != 8)
            {
                int j3 = view.getMeasuredWidth();
                int k3 = view.getMeasuredHeight();
                view.layout(l2, 0, l2 + j3, k3 + 0);
                l2 = k2 + (l2 + j3);
            }
            i3++;
        }
    }

    private void b(boolean flag, int i, int j, int k, int l)
    {
        int i1 = getChildCount();
        int j1 = 0;
        int k1 = 0;
        int l1 = 0;
        while(j1 < i1) 
        {
            View view1 = getChildAt(j1);
            if(view1.getVisibility() != 8)
            {
                l1 += view1.getMeasuredHeight();
                k1++;
            }
            j1++;
        }
        int i2 = l - j - l1;
        int j2;
        int k2;
        int l2;
        int i3;
        if(b)
            j2 = k1 + 1;
        else
            j2 = k1 + -1;
        k2 = i2 / j2;
        if(b)
            l2 = k2;
        else
            l2 = 0;
        i3 = 0;
        while(i3 < i1) 
        {
            View view = getChildAt(i3);
            if(view.getVisibility() != 8)
            {
                int j3 = view.getMeasuredWidth();
                int k3 = view.getMeasuredHeight();
                view.layout(0, l2, j3 + 0, l2 + k3);
                l2 = k2 + (l2 + k3);
            }
            i3++;
        }
    }

    protected void onLayout(boolean flag, int i, int j, int k, int l)
    {
        if(a)
            a(flag, i, j, k, l);
        else
            b(flag, i, j, k, l);
    }

    protected void onMeasure(int i, int j)
    {
        int k = 0;
        int l = getChildCount();
        int i1 = k;
        int j1 = k;
        while(i1 < l) 
        {
            View view = getChildAt(i1);
            if(view.getVisibility() != 8)
            {
                measureChild(view, i, j);
                if(a)
                {
                    j1 += view.getMeasuredWidth();
                    k = Math.max(k, view.getMeasuredHeight());
                } else
                {
                    k += view.getMeasuredHeight();
                    j1 = Math.max(j1, view.getMeasuredWidth());
                }
            }
            i1++;
        }
        setMeasuredDimension(resolveSize(j1, i), resolveSize(k, j));
    }

    private boolean a;
    private boolean b;
}
